<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    1.选商品 2.下单 3.收快递
    <script>
         function task1(){
            return new Promise(function(resoive,reject){
                // console.log('hello word');
                setTimeout(function(){
                    console.log('搜索商品');
                    resoive('华为 mate 60');//调用你传入的函数
                },2000);
            });
        }

        function task2(){
            return new Promise(function(resoive,reject){
                // console.log('hello word');
                setTimeout(function(){
                    console.log('下单购买');
                    resoive(6999);//调用你传入的函数
                },2000);
            });
        }

        function task3(){
            return new Promise(function(resoive,reject){
                // console.log('hello word');
                setTimeout(function(){
                    console.log('取快递订单号');
                    resoive('dd123121');//调用你传入的函数
                },2000);
            });
        }

        //如何保证1,2,3顺序
        task1().then(function(v){
            console.log('准备购买:',v);
            return task2();
        }).then(function(v){
            console.log('购买成功...费用:',v);
            return task3();
        }).then(function(v){
            console.log('取快递...订单号:',v);
        });
    </script>
</body>
</html>